package com.example.demo.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 张杰
 * Date: 2022-08-01
 * Time: 16:00
 */
@Controller
@ResponseBody //返回非静态页面数据
public class UserController {

    // 1.先得到日志对象
    private final static Logger log =
            LoggerFactory.getLogger(UserController.class);//打印该类的日志

    @RequestMapping("/sayhi")
    public void sayHi () {
        //2.使用日志类提供的方法进行打印日志
        log.trace("我是 trace");
        log.debug("我是 debug");
        log.info("我是 info");
        log.warn("我是 warn");
        log.error("我是 error");
    }
}
